# -*- coding: utf-8 -*- 

'''
Created on 2013-3-25
首页模块，将显示登陆界面和欢迎界面

@author: zhiyong.luo
'''
from framework.bottle import Bottle
from jinja2.environment import Environment
from jinja2.loaders import FileSystemLoader
from framework.gaesessions import get_current_session

#jinja2
env = Environment(loader = FileSystemLoader('static/templates'))
indexController = Bottle()
        
@indexController.route('/')    
def welcome():
    # 获取用户名称           
    session = get_current_session()
    
    username = ""
    if session.has_key('username'):  
        username = session['username']
    
    # 如果有用户名则显示出来
    template = env.get_template('index.html')
    return template.render(username=username)


    
        
    